
 /** 
 * Project Name:b2b-merBusi 
 * File Name:ObjectUtil.java 
 * Package Name:com.umpay.utils 
 * Date:2018年2月2日下午6:04:39 
 * Copyright (c) 2018, xmfsmasara@163.com.com All Rights Reserved. 
 * 
*/  
  
package com.umpay.utils;

import java.beans.PropertyDescriptor;
import org.apache.commons.beanutils.PropertyUtils;

import com.umpay.entity.consum.ConsumOrder;

/** 
 * ClassName:ObjectUtil <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * Reason:   TODO ADD REASON. <br/> 
 * Date:     2018年2月2日 下午6:04:39 <br/> 
 * @author   wangpengbo 
 * @version   
 * @see       
 */
public class ObjectUtil {

	
     /*****************************************************************
     * isEmpty:(判断对象是否为空). 
     * @author wangpengbo 
     * @param bean
     * @return
     *****************************************************************/ 
    public static boolean isEmpty(Object bean) {
        PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(bean);
        for (PropertyDescriptor origDescriptor : origDescriptors) {
            String name = origDescriptor.getName();
            if ("class".equals(name)) {
                continue;
            }
            if (PropertyUtils.isReadable(bean, name)) {
                try {
                    Object value = PropertyUtils.getSimpleProperty(bean, name);
                    if (value == null) {
                        continue;
                    } else {
                        return false;
                    }
                } catch (java.lang.IllegalArgumentException ie) {
                    ;
                } catch (Exception e) {
                    ;
                }
            }
        }
        return true;
    }
}
  